//
//  ILGButton.m
//  ILGDemo
//
//  Created by happy on 2020/3/6.
//  Copyright © 2020 Happy. All rights reserved.
//

#import "ILGButton.h"

@implementation ILGButton

 // 改变图片的点击范围
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {

    // 控件范围宽度多40，高度20
    CGRect bounds = CGRectInset(self.bounds, -20, -10);
//    NSLog(@"point = %@",NSStringFromCGPoint(point));
    UIBezierPath *path1 = [UIBezierPath bezierPathWithRect:CGRectMake(-20, -10, 40, 50)];
    UIBezierPath *path2 = [UIBezierPath bezierPathWithRect:CGRectMake(self.frame.size.width - 20, -10, 40, 50)];
    if (CGRectContainsPoint(bounds, point)){
        //如果在path区域内，返回YES
        return YES;
    }
    return NO;
}

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    return [super hitTest:point withEvent:event];
}

@end
